package com.kaka.bus.view.dialog;

import android.content.Context;
import android.support.annotation.NonNull;
import android.text.SpannableString;
import android.widget.ImageView;
import android.widget.TextView;

import com.kaka.bus.R;
import com.kaka.bus.util.U;

/**
 * Created by OnionMac on 2017/12/28.
 */

public class FeiLvDialog extends BaseDialog {

    private TextView mTotalMoney;
    private TextView mInfoManagerMoney;
    private TextView mAccountManagerMoney;
    private TextView mMonthMoney;
    private ImageView mClose;
    public FeiLvDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_feilv;
    }

    @Override
    protected void initView() {
        mTotalMoney = findViewById(R.id.dialog_feilv_totalmoney);
        mInfoManagerMoney = findViewById(R.id.dialog_feilv_infomanager_money);
        mAccountManagerMoney = findViewById(R.id.dialog_feilv_accountmanager_money);
        mMonthMoney = findViewById(R.id.dialog_feilv_monthrepay_money);

        mClose = findViewById(R.id.feilv_dialog_close);

        mClose.setOnClickListener(v -> {
            dismiss();
        });
    }

    public void setData(String total,String info,String account,String month){
        total = U.connectString(total,"元");
        SpannableString spannable = U.spannable(total, 25, 19, 0, total.indexOf("."), total.indexOf("."), total.length());
        mTotalMoney.setText(spannable);

        mInfoManagerMoney.setText(U.connectString(info,"元"));
        mAccountManagerMoney.setText(U.connectString(account,"元"));
        mMonthMoney.setText(U.connectString(month,"元"));
    }

    @Override
    protected double getWidthPer() {
        return 0.80;
    }
}
